#ifndef __TEST_H__
#define __TEST_H__

#include<string>
#include<cstdio>

#define TEST_FAIL( _errstr ) { TEST_STATUS=false; cout << "  [Línea " << __LINE__ << "] Falló: " << _errstr << endl; }

#define TEST_EQ( _x, _y ) if(_x!=_y) TEST_FAIL(toString(_x)+" == "+toString(_y))

#define TEST_START() TEST_STATUS=true;
#define TEST_END() return TEST_STATUS;

#define TEST(_n) { _n, #_n }
typedef bool(*TestCase)(void);

struct Test
{
	TestCase    test;
	std::string name;
};

bool TEST_STATUS;

std::string toString( double n )
{
	char buff[255];
	snprintf( buff, 255, "%.100g", n );
	return std::string(buff);
}

#endif

